﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Wheels
{
	public class Controller : System.Web.Mvc.Controller
	{
		protected Client Client { get; private set; }
		protected override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
		{
			if (this.Client == null)
			{
				this.Client = new Client(this.Request);
			}
            if ( Request.Params.Get("_height")!= null &&
                 Request.Params.Get("_width") != null)
            {
                int height, width;
                Int32.TryParse(Request.Params.Get("_height"), out height);
                Int32.TryParse(Request.Params.Get("_width"), out width);
                Client.ScreenHeight = height;
                Client.ScreenWidth= width;
            }

		    base.OnActionExecuting(filterContext);
		}
	}
}
